<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>修改密码</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../../css/user.css" media="all" />
<style type="text/css">     
    .mask {       
            position: absolute; top: 0px; filter: alpha(opacity=60); 
            z-index: 1002; left: 0px;              
			background:url(../../layui/layui/img/jz.gif) no-repeat center rgba(0,0,0,0.5) ;
		  	background-size:30px 30px;
			background-repeat: no-repeat;
			background: 
        }     
	</style> 
</head>
<body class="childrenBody">
<div id="mask" class="mask"></div>  
	<form class="layui-form changePwd">
		<div class="layui-form-item">
		    <label class="layui-form-label">个人账号</label>
		    <div class="layui-input-block">
		    	<input type="text" name="jpassword" id="jpassword" placeholder="请输入旧密码" lay-verify="required|oldPwd" class="layui-input pwd">
		    </div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">新密码</label>
		    <div class="layui-input-block">
		    	<input type="password" name="xpassword" id="xpassword" placeholder="请输入新密码" lay-verify="required|newPwd" class="layui-input pwd">
		    </div>
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">确认密码</label>
		    <div class="layui-input-block">
		    	<input type="text" id="qpassword" name="qpassword" placeholder="请确认密码" lay-verify="required|confirmPwd" class="layui-input pwd">
		    </div>
		</div>
		<div class="layui-form-item">
		    <div class="layui-input-block">
		    	<button class="layui-btn" id="submit" lay-submit="" lay-filter="changePwd">立即修改</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		</div>
	</form>
	<script type="text/javascript" src="../../layui/layui/jquery-3.2.1.min.js"></script>
	<script type="text/javascript">
		function s(){     
        $("#mask").css("height",$(document).height());     
        $("#mask").css("width",$(document).width());     
        $("#mask").show();     
	    }  
	    //隐藏遮罩层  
	    function h(){     
	          
	        $("#mask").hide();     
	    }  
	</script>
	<script type="text/javascript" src="../../layui/layui/layui.js"></script>
	<script>
		layui.use('layer', function(){
  			var layer = layui.layer;
		});              
	</script>
	<script>
	
		$("#submit").click(function(){
			function getPath() {  
	        return 'http://'+location.host;
			};
			var x=$("#xpassword").val();
			var q=$("#qpassword").val();
			var j=$("#jpassword").val();
			if(j=="" || j==null){
				//layer.alert("个人账号不能为空！"); 
				layer.alert('个人账号不能为空！', {
								      skin: 'layui-layer-molv' //样式类名  自定义样式
								     ,closeBtn: 1    // 是否显示关闭按钮
								      ,anim: 1 //动画类型
								     ,btn: ['确认'] //按钮
								      ,icon: 5    // icon
								     ,btn2:function(){
										
				}});
			}else if(x=="" || x==null){
				//layer.alert("新密码不能为空！");
				layer.alert('新密码不能为空！', {
								      skin: 'layui-layer-molv' //样式类名  自定义样式
								     ,closeBtn: 1    // 是否显示关闭按钮
								      ,anim: 1 //动画类型
								     ,btn: ['确认'] //按钮
								      ,icon: 5    // icon
								     ,btn2:function(){
										
				}});
			}else if(q==null || q==""){
				//layer.alert("确认密码不能为空！");
				layer.alert('确认密码不能为空！', {
								      skin: 'layui-layer-molv' //样式类名  自定义样式
								     ,closeBtn: 1    // 是否显示关闭按钮
								      ,anim: 1 //动画类型
								     ,btn: ['确认'] //按钮
								      ,icon: 5    // icon
								     ,btn2:function(){
										
				}});
			}else if(x!=q){
				//layer.alert("两次密码输入不一致");
				layer.alert('两次密码输入不一致！', {
								      skin: 'layui-layer-molv' //样式类名  自定义样式
								     ,closeBtn: 1    // 是否显示关闭按钮
								      ,anim: 1 //动画类型
								     ,btn: ['确认'] //按钮
								      ,icon: 5    // icon
								     ,btn2:function(){
										
				}});
			}else if(  x==q && (j!="" || j!=null)){
			s();
					 $.ajax({
							url : getPath()+'/wsyyt/mimacontroller/text',
							method : 'post',
							dataType : 'JSON',
							data: {'jpassword':j,'xpassword':x},
							success : function(result) {
							h();
								var code = result.code;
								if(code==0){
										layer.alert('提示：修改成功', {
									      skin: 'layui-layer-molv' //样式类名  自定义样式
									     ,closeBtn: 1    // 是否显示关闭按钮
									      ,anim: 1 //动画类型
									     ,btn: ['确认'] //按钮
									      ,icon: 6    // icon
									     ,yes:function(){
											window.location.href=window.location.href;
										}});  
								}else{		
										layer.msg('提示：'+result.CW,{icon: 5});
										layer.alert('提示：'+result.CW, {
									      skin: 'layui-layer-molv' //样式类名  自定义样式
									     ,closeBtn: 1    // 是否显示关闭按钮
									      ,anim: 1 //动画类型
									     ,btn: ['确认'] //按钮
									      ,icon: 5    // icon
									     ,btn2:function(){
										
										}});
								}
							}
					});		 
			}
		});		
	</script>
</body>
</html>